﻿<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=no" name="format-detection" />
	<meta content="emai=no" name="format-detection" />
	<link rel="stylesheet" type="text/css" href="/css/common.css" />
	<link rel="stylesheet" type="text/css" href="/css/apply.css" />
	<script src="/js/zepto-1.1.6.js" type="text/javascript"></script>
	<script src="/js/common.js" type="text/javascript"></script>
	<title>芝士妈妈个人推广申请</title>
</head>
<body>
<?php if($distributor == 0) {?>
<!--状态一：申请表单Start-->
<div class="wrapper">
	<h1>芝士妈妈个人推广申请</h1>
	<form  action="/spread/spread" method="post">
		<input type="text" name="name" id="name" value="" placeholder="请输入姓名" data-message="姓名不能为空" />
		<input type="tel" name="mobile" id="mobile" value="" placeholder="请输入手机号码" data-message="手机号码不能为空" />
		<input type="email" name="email" id="email" value="" placeholder="请输入邮箱" />
		<p>
			<span class="icon"><input type="checkbox" name="agree" value="1" /></span>
			<label>我同意<a href="spread/rule">双方友好合作协议书</a></label>
		</p>
		<button type="submit">提交申请</button>
	</form>
</div>
<script>
	Zepto(function ($) {
		checkStatus();
		baiaimama.validated = true;
		$("button[type='submit']").click(function (e) {
			baiaimama.validated = true;
			e.preventDefault();
			if ($(this).hasClass("disable")) {
				baiaimama.Toast.New("请确认已同意双方友好合作协议书");
			}
			else {
				validateInput("name");
				validateInput("mobile");
				validatePhone("mobile");
				if (baiaimama.validated) $("form").submit();
			}
		});
		$(".icon").click(function (e) {
			e.preventDefault();
			$(this).toggleClass("active");
			$("button[type='submit']").toggleClass("disable");
			if ($(this).hasClass("active")) {
				$(this).children("input").attr("checked", "checked");
			}
			else {
				$(this).children("input").removeAttr("checked");
			}
		});
	});
	function checkStatus() {
		if ($("input[type='checkbox']").attr("checked")) {
			$(".icon").addClass("active");
			$("button[type='submit']").removeClass("disable");
		}
		else {
			$(".icon").removeClass("active");
			$("button[type='submit']").addClass("disable");
		}
	}
</script>
<!--状态一：申请表单End-->
<?php }elseif($distributor == 1 ){?>
<!--状态二：正在审核Start-->
<div class="wrapper">
    <div class="notice">
        <img src="../img/d_w_smile.png" alt="" />
        <h1>您的芝士妈妈推广大使申请<span class="special">正在审核中</span>，请耐心等待！</h1>
    </div>
</div>
<!--状态二：正在审核End-->
<?php }elseif($distributor == 2 ){?>
<!--状态三：未通过审核Start-->
<div class="wrapper">
    <div class="notice">
        <img src="../img/d_w_cry.png" alt="" />
        <h1>您的芝士妈妈推广大使申请<span class="special">未通过审核</span>，请联系客服！</h1>
        <a class="btn" href="">重新申请</a>
    </div>
</div>
<!--状态三：未通过审核End-->
<?php }else{ ?>
	<!--状态四：通过审核Start-->
	<div class="wrapper">
		<div class="notice">
			<img src="../img/d_w_smile.png" alt="" />
			<h1>您已经是芝士妈妈的推广大使！</h1>
			<a class="link" href="/spread/qrcode">查看我的推广二维码</a>
			<a class="link" href="/spread/myspread">查看我的推广明细</a>
		</div>
	</div>
	<!--状态四：通过审核End-->
<?php } ?>
</body>
</html>
